<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/include.jsp"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资料库</title>
<link rel="stylesheet" type="text/css" href='<%=request.getContextPath()%>/css/css.css'/> 
<script type="text/javascript"> 
 function doUpload(){ 
     var f=document.getElementById("file").value;
     if(f!=''){
     	var fname=f.substring(f.lastIndexOf("\\")+1,f.length);
     	if(fname.length>100){
     		alert("文件名过长。");
     		return;
     	}
     	document.getElementById("filename").value=fname;
     	document.uploadForm.submit();
     }
     else{
     	alert("请选择要上传的文件。");
     	return;     
     }
}

 function doBack(){
 
 	document.uploadForm.action="upload!backtoviewZlxx.action";
    document.uploadForm.submit();
     
}
</script>
 </head> 
 <body> 
<div class="main">
<div class="main_title"><b>你当前的位置</b>：资料库-资料库维护-附件上传</div>
<s:form name="uploadForm" action="upload.action" namespace="/upload" enctype="multipart/form-data" method="post"> 
 <table align="center"  cellpadding="1" cellspacing="1" class="tablelist">	
        <s:hidden name="zlfj.TZlxx.id"/>	
		<s:if test="hasErrors()">
			<s:if test="hasFieldErrors()">
				<tr align="center">
					<td class="textError"><font color="red" size="4"><s:fielderror/></font></td>
					<td id="errortd" class="tableHeader2"></td>
				</tr>
			</s:if>
			<s:if test="hasActionErrors">
				<tr align="center">
					<td class="textError"><font color="blue"><s:actionerror/></font></td>
					<td class="tableHeader2"></td>
				</tr>
			</s:if>	
		</s:if>
		<tr class="listr2">
	        <td width="10%" align="right"><span class="fontred">*</span><s:label>资料文件地址</s:label></td>
			<td align="left" class="listr5"><s:file id="file" name="file" cssStyle="width:90%; border:1px solid #7F9DB9; height:22px;padding-top:2px;margin-top:2px"/><s:hidden id="filename" name="filename" /></td>
		</tr>     
 </table>
 <p>
 <input type="button" value="开始上传" class="longbtn" onmouseover="this.className='longbtn_hover'" onmouseout="this.className='longbtn'" onclick="doUpload()"></input> 
 <input type="button" value="返回" class="btn" onmouseover="this.className='btn_hover'" onmouseout="this.className='btn'" onclick="doBack()"></input>
 </s:form> 
 </div>
 </body> 
 </html> 